package com.cn.gmall.order.client;

import com.cn.gmall.common.result.Result;
import com.cn.gmall.model.order.OrderInfo;
import com.cn.gmall.order.client.impl.OrderDegradeFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;


@FeignClient(value = "service-order",fallback = OrderDegradeFeignClient.class)
//@FeignClient(value = "service-order")
public interface OrderFeignClient {


    /** 给秒杀使用 (此时不需要判断 校验库存 以及价格)
     * /api/order/inner/seckill/submitOrder
     * @param orderInfo
     * @return
     */
    @PostMapping("/api/order/inner/seckill/submitOrder")
    public Long submitOrderReturnId(@RequestBody OrderInfo orderInfo);

    /***
     * /api/order/inner/getOrderInfo/{orderId}
     * 根据订单Id 查询订单信息
     * @param orderId
     * @return
     */
    @GetMapping("/api/order/inner/getOrderInfo/{orderId}")
    public Result<OrderInfo> getOrderInfo(@PathVariable Long orderId);

    /**
     * 去结算
     *  /api/order/auth/trade
     *  HttpServletRequest 作为参数 可以不写 springMvc 会做处理
     * @param
     * @return
     */

    @GetMapping("/api/order/auth/trade")
    public Result toTrade();
}
